/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package serveurtp2;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;

/**
 *
 * @author scriptoff
 */
public class Main {


    private static boolean usageOk(String[] argv) {
        if (argv.length != 1) {
            String msg = "usage is: "
                       + "programme port";
            System.out.println(msg);
            return false;
        } // if
        return true;
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args){
        if (System.getSecurityManager() == null) {
            System.setSecurityManager(new RMISecurityManager());
        }
        try {
            CoucheMetier obj = new CoucheMetier();
            // Bind this object instance to the name "RemoteServer"
            Naming.rebind("CoucheMetier", obj);

            System.out.println("RemoteServer bound in registry");

        } catch (Exception e) {
            System.out.println("RemoteResourcesImpl err: " + e.getMessage());
            e.printStackTrace();
        }
        /*if(!usageOk(args))
            System.exit(1);
        int port = 0;
        try{
            port = Integer.parseInt(args[0]);
        }catch(NumberFormatException e){
            System.out.println("Je tourne sur le port par défaut 1234");
            port = 1234;
        }*/
        
        //Server s = new Server(port);
        //s.runServer();
    }

}
